package com.css.apps.base.org.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.common.provider.json.OrgJsonProvider;
import com.css.apps.base.user.action.UserAction;
import com.css.core.configuration.Environment;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.util.StringHelper;
import com.opensymphony.xwork.Action;

@SuppressWarnings("serial")
public class GetOrgUserTree extends UserAction {
	
	private static Log log = LogFactory.getLog(GetOrgUserTree.class);
	private String no, toUrl;

	@Override
	protected String userGo() {
		try {
			OrgJsonProvider json = new OrgJsonProvider();
			result = json.getOrgUserTree().toString();
			if (StringHelper.isEmpty(toUrl)) {
				toUrl = "/acl/org/getorgusertree.jsp";
			}
			return SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getToUrl() {
		return toUrl;
	}

	public void setToUrl(String toUrl) {
		this.toUrl = toUrl;
	}

}
